package h0803;

import java.util.Scanner;

/**
 * @author 不知名帅哥
 * @version 1.0
 * @description 最长指定瑕疵度的元音子串
 * @date 2024/8/3 16:15
 */
public class TheLongestFlawsVowelSubstring {
    static String p = "aeiouAEIOU";

    static int flaws;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //允许的瑕疵度
        flaws = n;
        sc.nextLine();
        String s = sc.nextLine();

        int ans = 0;
        for (int start = 0; start < s.length(); start++) {
            for (int end = start; end < s.length(); end++) {
                String temp=s.substring(start,end+1);
                if (!p.contains(String.valueOf(temp.charAt(0)))) break;
                if (isVowel(temp)){
                    ans=Math.max(temp.length(),ans);
                }
            }
        }
        System.out.println(ans);
    }

    private static boolean isVowel(String temp) {
        int n = temp.length();
        if (!p.contains(String.valueOf(temp.charAt(0))) || !p.contains(String.valueOf(temp.charAt(n - 1)))) {
            return false;
        }
        int count = 0;
        for (int i = 1; i < n - 1; i++) {
            char c = temp.charAt(i);
            //不是元音字母
            if (count > flaws) {
                return false;
            } else if (!p.contains(String.valueOf(c))) {
                count++; //TODO 这里统计的次数有可能下一次循环就结束了，所以要在最后判断是否仍然count<=flaws;
            }
        }
        return count==flaws;
    }
}
